{include file="public/header" /}


<div class="page">
    <div class="fixed-bar">
        <div class="item-title">
            <div class="subject">
                <h3>{$Think.lang.adv_index_manage}</h3>
            </div>
            {include file="public/admin_items" /}
        </div>
    </div>
    <form method="get" name="formSearch" id="formSearch">
        <div class="ds-search-form">
            <dl>
                <dt>{$Think.lang.adv_ap_id}</dt>
                <dd>
                    <select name="ap_id">
                        <option value="">{$Think.lang.ds_please_choose}...</option>
                        {foreach name="ap_list" item="ap_v"}
                        <option value="{$ap_v.ap_id}" {if condition="$Request.param.ap_id eq $ap_v.ap_id" }selected{
                        /if}>{$ap_v.ap_name}[{$ap_v.ap_width}X{$ap_v.ap_height}]</option>
                        {/foreach}
                    </select>
                </dd>
            </dl>
            <div class="btn_group">
                <input type="submit" class="btn" value="{$Think.lang.ds_search}">
                {if $filtered}
                <a href="{:url('Adv/adv')}" class="btn btn-default" title="{$Think.lang.ds_cancel}">{$Think.lang.ds_cancel}</a>
                {/if}
            </div>
        </div>
    </form>

    <div class="fixed-empty"></div>
    <form method="post" id="store_form">
        <table class="ds-default-table">
            <thead>
            <tr class="thead">
                <th class="w24"></th>
                <th class="w300">{$Think.lang.adv_name}</th>
                <th class="w300">{$Think.lang.adv_ap_id}</th>
                <th class="w60">{$Think.lang.adv_sort}</th>
                <th class="w60">{$Think.lang.adv_clicknum}</th>
                <th class="w200">{$Think.lang.adv_code}</th>
                <th class="w60">{$Think.lang.adv_enabled}</th>
                <th class="w150">{$Think.lang.adv_start_time}</th>
                <th class="w150">{$Think.lang.adv_end_time}</th>
                <th class="align-center">{$Think.lang.ds_handle}</th>
            </tr>
            </thead>
            <tbody>
            {notempty name="adv_info"}
            {foreach name="adv_info" item="v"}
            <tr class="hover" id="ds_row_{$v.adv_id}">
                <td class="w24"><input type="checkbox" class="checkitem" name="del_id[]" value="{$v.adv_id}"/></td>
                <td class="name"><span class="editable" ds_type="inline_edit" ajax_branch='adv_branch'
                                       fieldname="adv_title" fieldid="{$v.adv_id}" required="1"
                                       title="{$Think.lang.ds_editable}">{$v.adv_title}</span></td>
                <td>
                    {foreach name="ap_list" item="ap_v"}
                    {if $ap_v.ap_id === $v.ap_id }
                    <span title="{$ap_v.ap_name}">{$ap_v.ap_name}</span>
                    {/if}
                    {/foreach}
                </td>
                <td class="sort"><span title="{$Think.lang.ds_editable}" ajax_branch="adv_branch" datatype="number"
                                       fieldid="{$v.adv_id}" fieldname="adv_sort" ds_type="inline_edit"
                                       class="editable">{$v.adv_sort}</span></td>
                <td>{$v.adv_clicknum|default='0'}</td>
                <td>
                    <a data-lightbox="lightbox-image" data-title="{$v.adv_title}"
                       href="{$Think.config.oss_img_path.admin_adv_img_path}{$v.adv_code}">
                        <img src="{$Think.config.oss_img_path.admin_adv_img_path}{$v.adv_code}"
                             onload="javascript:ResizeImage(this,60,60);"/>
                    </a>
                    <!--<a data-lightbox="lightbox-image" data-title="{$v.adv_title}" href="{$Think.UPLOAD_SITE_URL}/{$Think.ATTACH_ADV}/{$v.adv_code}">-->
                    <!--<img src="{$Think.UPLOAD_SITE_URL}/{$Think.ATTACH_ADV}/{$v.adv_code}" onload="javascript:ResizeImage(this,60,60);" />-->
                    <!--</a>-->
                </td>
                <td class="yes-onoff">
                    {if $v.adv_enabled eq '0'}
                    <a href="JavaScript:void(0);" class=" disabled" ajax_branch="adv_branch" ds_type="inline_edit"
                       fieldname="adv_enabled" fieldid="{$v.adv_id}" fieldvalue="0"
                       title="{$Think.lang.ds_editable}"><img
                            src="{$Think.ADMIN_SITE_ROOT}/images/treetable/transparent.gif"></a>
                    {else /}
                    <a href="JavaScript:void(0);" class=" enabled" ajax_branch="adv_branch" ds_type="inline_edit"
                       fieldname="adv_enabled" fieldid="{$v.adv_id}" fieldvalue="1"
                       title="{$Think.lang.ds_editable}"><img
                            src="{$Think.ADMIN_SITE_ROOT}/images/treetable/transparent.gif"></a>
                    {/if}
                </td>
                <td>{$v.adv_startdate|date='Y-m-d',###}</td>
                <td>{$v.adv_enddate|date='Y-m-d',###}</td>
                <td>
                    <a href="javascript:dsLayerOpen('{:url('Adv/adv_edit',['adv_id'=>$v.adv_id])}','{$Think.lang.ds_edit}-{$v.adv_title}')"
                       class="dsui-btn-edit"><i class="iconfont"></i>{$Think.lang.ds_edit}</a>
                    <a href="javascript:dsLayerConfirm('{:url('Adv/adv_del',['adv_id'=>$v.adv_id])}','{$Think.lang.ds_ensure_del}',{$v.adv_id})"
                       class="dsui-btn-del"><i class="iconfont"></i>{$Think.lang.ds_del}</a>
                </td>
            </tr>
            {/foreach}
            {else /}
            <tr class="no_data">
                <td colspan="15">{$ap_name}{$Think.lang.ds_no_record}</td>
            </tr>
            {/notempty}
            </tbody>
        </table>
        {$show_page}
    </form>
</div>
<script type="text/javascript" src="{$Think.ADMIN_SITE_ROOT}/js/jquery.edit.js" charset="utf-8"></script>
<link rel="stylesheet" href="{$Think.PLUGINS_SITE_ROOT}/js/jquery.lightbox/css/lightbox.min.css">
<script src="{$Think.PLUGINS_SITE_ROOT}/js/jquery.lightbox/js/lightbox.min.js"></script>